from flask import Blueprint, request, jsonify
import json

from db import db1

bp_course = Blueprint('course', __name__)


def get_data():
    data = request.data
    if data:
        data = json.loads(data)
    else:
        data = request.form
    return data



#通过分类id获取分类参数
@bp_course.route('/getCateByid')
def getCateByid():
    id = request.args.get('id')
    sql = "select params from cates where id=%d"%(int(id))
    res = db1.find(sql)
    return jsonify({'code':200,'params':res['params']})